unit Checkers.MoveQuee;

interface

uses
  GLSGenerics;

type
  TQueeElement = class
  public
    Start: Integer;
    Finish: Integer;
    Index: Integer;
    Upgrade: Boolean;
  end;

  TQueeList = GList<TQueeElement>;

  TMoveQuee = class
  private
    FList: TQueeList;
    FTag: Integer;
    function GetTag: Integer;
    procedure SetTag(const ATag:Integer);
    function GetCount: Integer;
    function GetItem(AIndex: Integer): TQueeElement;
  public
    constructor Create(const ATag: Integer = 0);
    procedure Add(const AStart, AFinish, AIndex:Integer; const AUpgrade:Boolean = False); overload;
    procedure Add(const AElemnt:TQueeElement); overload;
    procedure Clear(ATag:Integer = 0);
    property Tag: Integer read GetTag write SetTag;
    property Count:Integer read GetCount;
    property Items[AIndex:Integer]: TQueeElement read GetItem;
  end;

implementation

{ TMoveQuee }

procedure TMoveQuee.Add(const AStart, AFinish, AIndex:Integer; const AUpgrade:Boolean = False);
var
  vElement:TQueeElement;
begin
  vElement := TQueeElement.Create;
  vElement.Start := AStart;
  vElement.Finish := AFinish;
  vElement.Index := AIndex;
  vElement.Upgrade :=  AUpgrade;
  FList.Add(vElement);
end;

procedure TMoveQuee.Add(const AElemnt: TQueeElement);
begin
  FList.Add(AElemnt);
end;

procedure TMoveQuee.Clear(ATag:Integer = 0);
begin
  FTag := ATag;
  FList.Clear;
end;

constructor TMoveQuee.Create(const ATag: Integer = 0);
begin
  FTag := ATag;
  FList := TQueeList.Create;
end;

function TMoveQuee.GetCount: Integer;
begin
  Result := FList.Count;
end;

function TMoveQuee.GetItem(AIndex: Integer): TQueeElement;
begin
  Result := FList[AIndex];
end;

function TMoveQuee.GetTag: Integer;
begin
  Result := FTag;
end;

procedure TMoveQuee.SetTag(const ATag:Integer);
begin
  FTag := ATag;
end;

end.
